#include"Square.h"

#ifdef _MAC_OS_
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#endif

void
Square::draw() const{
  glColor3f(_color._x, _color._y, _color._z);

  glBegin (GL_TRIANGLES);
  glVertex2f (_pos._x, _pos._y);
  glVertex2f (_pos._x, _pos._y + _dim._y);
  glVertex2f (_pos._x + _dim._x, _pos._y);
                                                               
  glVertex2f (_pos._x + _dim._x, _pos._y + _dim._y); 
  glVertex2f (_pos._x, _pos._y + _dim._y);
  glVertex2f (_pos._x + _dim._x, _pos._y);

  glEnd (); 
}

void
Square::setPosition(vec2f v){
  _pos._x = v._x;
  _pos._y = v._y;
}

void
Square::setPosition(float x, float y){
  _pos._x = x;
  _pos._y = y;
}

void
Square::setSpeed(vec2f speed){
  _speed = speed;
}
